<?php
ini_set('display_errors', 'Off');
	$id = intval($_GET['id']);
	$ep=mangaf2_get_ep($id);

	$data=mangaf2_get_manga($ep['manga']);
	if($data['adult']==1){
		header("HTTP/1.0 404 Not Found");
		echo " Noi dung khong ton tai";
		exit();
	}
	$data['ep']=$ep;
	
	 // echo "This contains characters other than just numbers"; 
	$string=mangaf1_tag2_generate($data['name'],$ep['ten'],$ep['thutu']);
	$data['ep']['data_tags']=mangaf1_tag2_link($data['name'],$ep['ten'],$ep['thutu']);
				
	
	//if($ep['gtag']==){
	//	anime_tag2($id,$ep['manga'],$string);
	//}
	
	$val['manga']=$data['name'];
	$val['chap']=$ep['ten'];
	$data1=mangaf2_generate_tags("chap",$val);
	
	$og='<meta property="og:type" content="book" />
<meta property="og:image" content="'.$data['hinhanh'].'"/>
<meta property="og:locale" content="vi_VN" /> 
<meta property="og:title" content="'.$data['name'].' '.str_ireplace('chapter','chap',$ep['ten']).'- đọc truyện online"/>
<meta property="og:description" content="Đọc truyện '.$data['name'].' '.str_ireplace('chapter','chap',$ep['ten']).' tiếng việt"/> 
<meta property="og:url" content="'.url().'"/> ';
   $data1['og']=$og;	
// End get truyen cung tac gia-------
//Block phan theo doi, vi se qua tai , gay ra loi 
/*
		$carray = array(
			'truyen'=> $data['name'],
			'truyen_link' => url_anime($data['id'], $data['alias']),
			'chuong_id' => $id, 
			'chuong_link' => url_anime_episode($id, $data['ep']['seourl']),
			'tenchuong' => $data['ep']['ten']
		);

	
	$sc = json_encode($carray);
	$mg=$ep['manga'];

	
	
	//"tc[".$mg."]" , phai dat la tc de luu vao mang cookie nhe
	setcookie("tc[".$mg."]", $sc, strtotime( '+30 days' ), '/');
	*/
   	//Lay the loai 2, lay duoc list chuong, update view, update so chuong hien co,update view
	anime_view($ep['manga'],intval($id));
	
	
	//HEADER TITLE,KEYWORD,DESCRIPION
	
	
	/*
	
	$data1['title']=$data['name']." ".str_ireplace('chapter','chap',$ep['ten'])." - đọc truyện online";
	$data1['mota']="Đọc truyện ".$data['name']." ".str_ireplace('chapter','chap',$ep['ten'])." tiếng việt";
	$data1['keyword']=$data['name']." ".str_ireplace('chapter','chap',$ep['ten']).",".$data['alias']." ".khongdau(str_ireplace('chapter','chap',$ep['ten'])).",doc truyen ".$data['name']." ".str_ireplace('chapter','chap',$ep['ten'])." tieng viet,".$data['name']." ".str_ireplace('chapter','chap',$ep['ten'])." tieng viet";
	*/

loadview('template/header2',$data1);
loadview("anime/view_ep",$data);
loadview('template/footer2');
exit();

 //    loadview("template/right",$right);

?>